package com.mpyy.handler.inventory;

import com.alibaba.fastjson.JSON;
import com.mpyy.pojo.InventoryDesc;
import com.mpyy.service.inventory.InventoryOverdueServiceInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

/**
 * @Description InventoryOberdueController
 * @Author wx
 * @Date 2022-02-28 19:26
 * @Version 1.0
 */
@Controller
public class InventoryOberdueController {
    @Autowired
    @Qualifier(value = "inventoryOverdueServiceImpl")
    private InventoryOverdueServiceInter serviceInter;

//    @RequestMapping("/showOberdueProcess")
//    @ResponseBody
//    public String showoOberdueProcess(HttpServletRequest req){
//
//        String state = req.getParameter("state");
//
//        if(null==state){
//            state="0";
//        }
//        List <InventoryDesc> inventoryOberdue = null;
//        switch (state){
//            case "1":
//                inventoryOberdue = serviceInter.showoOberdue(0);
//                break;
//            case "0":
//                inventoryOberdue = serviceInter.showoOberdue(1);
//                break;
//        }
//        System.out.println(state);
//        HashMap <Object, Object> inventoryOberdueMap = new HashMap <>();
//        inventoryOberdueMap.put("code",0);
//        inventoryOberdueMap.put("msg","");
//        inventoryOberdueMap.put("count",2);
//        inventoryOberdueMap.put("data",inventoryOberdue);
//        return JSON.toJSONString(inventoryOberdueMap);
//    }
    @RequestMapping("/searchNunAndName")
    @ResponseBody
    public String searchNunAndName(InventoryDesc inventoryDesc){
        List <InventoryDesc> inventoryDescs = serviceInter.selectNumber(inventoryDesc);
        HashMap <Object, Object> inventoryOberdueMap = new HashMap <>();
        inventoryOberdueMap.put("code",0);
        inventoryOberdueMap.put("msg","");
        inventoryOberdueMap.put("count",2);
        inventoryOberdueMap.put("data",inventoryDescs);
        return JSON.toJSONString(inventoryOberdueMap);
    }
}
